n = int(input())
a = []
for _ in range(n):
    a.append([0]*n)
a[0][n//2] = 1

for k in range(2,n**2+1):
    if (k-1) in a[0]: # 在第一行
        if a[0][n-1] == (k-1): # 在最后一列
            a[1][n-1] = k
        else: 
            j = a[0].index(k-1)
            a[n-1][j+1] = k
    else: # 不在第一行
        for i in range(1,len(a)):
            if (k-1) in a[i]:
                if a[i][n-1] == (k-1): # 在最后一列
                    a[i-1][0] = k
                else:
                    j = a[i].index(k-1)
                    if a[i-1][j+1] == 0:
                        a[i-1][j+1] = k
                    else:
                        a[i+1][j] = k
                break
for x in a:
    print(' '.join(list(map(str,x))))    